--
-- 负载均衡.
--

local bl = require "ngx.balancer"

local function balancer()
  --- 测试数据
  local host = "171.221.172.13"
  local port = 8888

  --- TODO 补充负载均衡算法
  local ok, err = bl.set_current_peer(host, port)
  if not ok then
    ngx.log(ngx.ERR, "failed to set the current peer: ", err)
    return ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
  end
end

balancer()